package ymos.steamcode.steamcode.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SteamCodeController {
	@GetMapping("getcode")
	public Json getCode(String shared) {
		long time = System.currentTimeMillis()/1000;
		Json json = new Json();
		try {
			String steamcode = SteamCodeGenerator.generateSteamGuardCodeForTime(time, shared);
			json.setSteamCode(steamcode);
		} catch (Throwable e) {
			json.setSteamCode("获取失败");
		}
		return json;
	}
}
